home *** CD-ROM | disk | FTP | other *** search
/ ASME's Mechanical Engine…ing Toolkit 1997 December / ASME's Mechanical Engineering Toolkit 1997 December.iso / c_lang / pcc_code.lzh / FUNCTION.DOC < prev    next >
Encoding:
Text File  |  1986-03-24  |  28.6 KB  |  820 lines

  1.  
  2. Since I've downloaded so much useful software from this bulletin board, I
  3. felt inclined to contribute some.  These are some DOS functions that I
  4. use quite a bit.  Most of them have been tested pretty much, but they're
  5. free so no warranties.  Hope someone out there gets some use from
  6. these.
  7.  
  8.     Tom Serface
  9.  
  10.  
  11. ACCESS.C --
  12.     int access() - See if a file exists and can be opened.
  13.         Returns 0 (NO) 1 (YES)
  14.  
  15. ANNUITY.C --
  16.     double annuity(r,i,n,y)
  17.         This calculates the future value realized given a
  18.         regular deposit to an annuity, nominal interest rate,
  19.         number of deposits per year, and the total number of
  20.         of deposits that will be made (assumes 1 deposit per period)
  21.  
  22.         double r = regular deposit
  23.         double i = annual interest rate
  24.         int n    = number of deposits per year
  25.         int y    = number of total deposits
  26.  
  27. BETWEEN.C --
  28.     int between(sm,sd,sy,m,d,y)
  29.         Returns the number of days between two dates
  30.             int sm = Start Month
  31.             int sd = Start Day
  32.             int sy = Start Year
  33.             int m  = End Month
  34.             int d  = End Day
  35.             int y  = End Year
  36.  
  37. BREAK.A --
  38.     int GetBreak() - Get Current Setting of the DOS Break Command
  39.         Returns:    0=Off
  40.                     1=On
  41.     void SetBreak(breakval) - Set the Dos Break Command
  42.         Where:
  43.             int BreakVal = 0 for OFF  1 for ON
  44.  
  45. CENTER.C --
  46.     void center(s2,s1,ncols) - Center a String into Another String
  47.         Where:
  48.             char *s1 = the string to center
  49.             char *s2 = the destination string
  50.            int ncols = the number of columns
  51.  
  52.      s2 must be at least ncols wide or memory problems occur
  53.  
  54. CHDIR.A --
  55.     int ChDir(directory) - Change Directory
  56.         Returns:    0=changed directory successfully
  57.                        3=not a good path in str
  58.                     5=could not change directory
  59.         Where:
  60.               char *directory = String with path name
  61.  
  62. COPY.C --
  63.     int copy(from,to) -    copy file named FROM to file named TO.                     
  64.         Returns:     0=error
  65.                      1=worked
  66.         Where:
  67.             char *from = file to copy
  68.             char *to   = new name of a file to create
  69.  
  70.         If a file named TO exists, it is deleted prior to copy. 
  71.  
  72.  
  73. CRC.C --
  74.      There are two kinds of checksums that can be used.  The first is
  75.      simply the sum of the bytes without paying attention to carry.  This will
  76.      work most of the time, and is 1 byte per packet faster, but the second
  77.      type CRC is a lot more reliable.  The CRC is two bytes and is calculated
  78.      as a polynomial.  The algorithm is described in Andrew S. Tanenbaum's
  79.      book "Computer Networks" and will detect single and double bit errors
  80.      all errors with an odd number of bits, all burst errors 16 bits or
  81.      less, 99.997% of 17 bit burst errors, and 99.998% or 18 bit and longer
  82.      bursts.
  83.  
  84.     short crc(string,len) - Calculate 2 byte CRC
  85.         Returns:    Calculated CRC
  86.         Where:
  87.             char *string = string to use for CRC calculation
  88.                  int len = length of the string
  89.                 
  90.     short chksum(string,len) - Calculate 1 byte checksum without paying
  91.                                attention to carry.
  92.         Returns:    Calculated CheckSum
  93.         Where:
  94.             char *string = string to use for CRC calculation
  95.                  int len = length of the string
  96.                 
  97.     short crcfile(fName) - Calculate 2 byte CRC for a file.
  98.         Returns:    Calculated CRC
  99.         Where:
  100.             char *fName = name of file to check
  101.         This is useful for comparing 2 files to make sure that they
  102.         are exactly the same.
  103.  
  104. CURDSK.A --
  105.     int CurDsk() - Get Current Disk Number
  106.     Returns:    0=A  (Drive Number)
  107.                 1=B
  108.                 2=C
  109.                 .
  110.                 .
  111.  
  112. DAYOFWK.C --
  113.     int dayofwk(month,day,year) - Returns the day of the week.
  114.         Returns:    0=Sunday
  115.                     1=Monday
  116.                     2=Tuesday
  117.                     .
  118.                     .
  119.                     .
  120.         Where:
  121.             int month
  122.             int day
  123.             int year
  124.  
  125. DAYOFYR.C --
  126.     int dayofyr(month,day,year) - Returns the day of the year.
  127.         Returns:    1=Jan 1st
  128.                     2=Jan 2nd
  129.                     .
  130.                     .
  131.                     .
  132.         Where:
  133.             int month
  134.             int day
  135.             int year
  136.  
  137. DISK.A --
  138.     long DiskSize(disk,&total);
  139.     Returns:    Free space remaining on drive
  140.                 -1 if the drive is invalid
  141.     Where:
  142.         int disk = disk number 0=default, 1=A, 2=B, 3=C ...
  143.      long *total = buffer to store total disk size
  144.  
  145. EFFECTIVE.C --
  146.     double effective(p,f,n,y) 
  147.      Returns:
  148.         This calculates the effective interest rate for an investment
  149.         given the initial amount, the expected future amount, the
  150.         number of compounding periods per year, and the total number
  151.          of periods the    investment will exist.
  152.     Where:
  153.         double p = principal (initial investment)
  154.         double f = future value of the investment
  155.         int n    = number of payments per year
  156.         int y    = number of total payments
  157.  
  158. EQUIP.A --
  159.     unsigned equip() - Get equipment status
  160.     Returns:    2 byte equipment status
  161.  
  162.     unsighned Hdisks() - Get number of hard disks
  163.     Returns:    Number of Fixed Disks.
  164.  
  165.  
  166. EQUIPMENT.C --
  167.     int equipment(type) - See what is hooked onto the PC.
  168.     Returns:    number of a particular equipment type.
  169.                 0 if there is and error or none of a particular type
  170.     Where:
  171.         int type = type of equipment to query
  172.     Types are:
  173.         1 - printers
  174.         2 - game ports
  175.         3 - rs232 ports
  176.         4 - diskette drives
  177.         5 - initial video mode
  178.             0 40x25 BW with color card    
  179.             2 80x25 BW with color card
  180.             7 monochrome
  181.         6 - number of fixed disks 
  182.  
  183. FDATE.C
  184.     char *fdate(buffer);
  185.          Formatted date and time (Day Month Day, Year Time am/pm)
  186.             e.g., Monday May 13, 1985 8:25pm
  187.             This routine should be called with a buffer that has at least
  188.             40 characters.
  189.             Returns:     The address of the buffer you passed thru so that
  190.                          you can do stuff like printf("%s",fdate(buffer));
  191.  
  192.  
  193. FINDFIRST.A --
  194.     DOS 2.0 functions to find files given filespec the argument to
  195.     FindFirst() is a pointer to a filespec containing d:\path\filespec
  196.     and an integer permission attribute for the files to find.
  197.     FindNext() simply continues and fills in the DTA area with the file
  198.     matching the next pattern.
  199.     In the calling program you would first call SetDta(&dataArea);
  200.     and then call FindFirst(filespec,attr) finally subsequent calls to
  201.     FindNext(attr) can be made. 
  202.     The filename and attributes can be read from dataArea.
  203.  
  204.     FileFind.h must be included in any subroutines using these routines.
  205.         Attributes for FindFirst, FindNext, GetMod, and ChMod
  206.         You can set or check with '&' e.g., (attr & F_DIRECTORY)
  207.         if(attr & (F_READ_ONLY & F_HIDDEN)
  208.             F_NORMAL    0x00
  209.             F_READ_ONLY    0x01
  210.             F_HIDDEN    0x02
  211.             F_SYSTEM    0x04
  212.             F_LABEL        0x08
  213.             F_DIRECTORY    0x10
  214.             F_ARCHIVE    0x20
  215.             F_ALL        0xFF
  216.  
  217.     struct DataArea {
  218.         char dta_reserved[21];
  219.         char dta_attribute;
  220.         short int dta_time;
  221.         short int dta_date;
  222.         long int dta_file_size;
  223.         char dta_name[13];
  224.     } ;
  225.  
  226.     void SetDta(&DTA) - Set up DTA for Wild Card Conversions or whatever
  227.                 This version assumes that the Struct is in the programs DS.
  228.         Where:
  229.              dataArea = struct *DataArea DTA
  230.  
  231.     void GetDta(&segment,&offset) - Get the current DTA segment and offset
  232.         Where:
  233.             unsigned segment = segment of the DTA
  234.             unsigned offset  = offset from segment beginning
  235.  
  236.     void RestDta(segment,offset) - Restore a saved DTA segment and offset
  237.         Where:
  238.             unsigned segment = saved DTA segment
  239.             unsigned offset  = saved offset from segment beginning
  240.  
  241.     int FindFirst(filespec,attr) - Find the First File From a Wild Card Pattern
  242.         Returns:    0=not found
  243.                     1=found
  244.         Where:
  245.             char *filespec = pattern of file name to find
  246.             int attr       = attribute for the file
  247.                 F_NORMAL       0x00
  248.                 F_READ_ONLY    0x01
  249.                 F_HIDDEN       0x02
  250.                 F_SYSTEM       0x04
  251.                 F_LABEL        0x08
  252.                 F_DIRECTORY    0x10
  253.                 F_ARCHIVE      0x20
  254.                 F_ALL          0xFF
  255.  
  256.     int FindNext(attr) - Find the Next File From a Wild Card Pattern
  257.         Returns:    0=not found
  258.                     1=found
  259.         Where:
  260.             int attr       = attribute for the file
  261.                 F_NORMAL       0x00
  262.                 F_READ_ONLY    0x01
  263.                 F_HIDDEN       0x02
  264.                 F_SYSTEM       0x04
  265.                 F_LABEL        0x08
  266.                 F_DIRECTORY    0x10
  267.                 F_ARCHIVE      0x20
  268.                 F_ALL          0xFF
  269.  
  270. FV.C --
  271.     double fv(p,i,n,y) 
  272.         This calculates the future value that can be expected
  273.         from an investment given the initial value, annual interest,
  274.         number of compounding periods (e.g., months    per year, and the total
  275.         number of periods the investment will exist.
  276.         Returns:    Calculated future value
  277.         Where:
  278.             double p = present value
  279.             double i = annual interest  rate
  280.             int n    = number of periods per year
  281.             int y    = number of total periods
  282.  
  283. GETDATE.A --
  284.     int GetDate(&month,&day,&year) - Get Date Information
  285.     Returns:    day of the week
  286.     Where:
  287.         int month
  288.         int day
  289.         int year
  290.  
  291.     int SetDate(month,day,year) - Set Date Information
  292.     Returns:    0=worked
  293.                -1=error
  294.     Where:
  295.         int month
  296.         int day
  297.         int year
  298.  
  299. GETDIR.A --
  300.     int GetDir(drive,directory) - Get Current Directory
  301.     Returns:    0Fh if invalid drive
  302.                 0 if worked
  303.     Where:
  304.         int drive = disk number (0=default, 1=A, 2=B, 3=C ...)
  305.         char *directory = buffer to store the directory path
  306.                           the buffer should be at least 85 chars
  307.  
  308. GETPATH.C --
  309.     int _exec(prog,args) - exec using PATH
  310.         Execs a program after finding it in PATH
  311.         Returns:    -1=prog not found/error
  312.                     -2=not a .EXE or .COM file
  313.                      otherwise returns the return code from prog
  314.         Where:
  315.             char *prog=program to execute
  316.             char *args=arguments for prog
  317.  
  318.     int _chain(prog,args) - chain using PATH
  319.         Chains to a new program after finding it in PATH
  320.         Returns:    -1=prog not found/error
  321.                     -2=not a .EXE or .COM file
  322.                      otherwise doesn't return
  323.         Where:
  324.             char *prog=program to chain
  325.             char *args=arguments for prog
  326.  
  327.     char *GetPath(prog,path) - Get the PATH for an executable
  328.         Returns:    Pointer to path for the prog
  329.                     0 for program not found
  330.         Where:
  331.             char *prog=program to find
  332.             char *args=buffer to hold path for prog including prog name
  333.  
  334.         
  335. GETENV.C --
  336.     char *GetEnv(variable, buffer, len)
  337.         Retrieves the contents of an environment variable set with the
  338.         DOS command SET VAR=CONTENTS.
  339.         Returns:    Address of buffer
  340.                     0 if variable not found
  341.         Where:
  342.             char *variable=environment variable to retrieve e.g., "PATH"
  343.             char *buffer  =holding place for environment variable
  344.                            should be at least 128 chars unless you
  345.                            know that the variable will be less
  346.             int len       =maximum length to copy to buffer including the
  347.                            NULL byte '\0' at the end of the string.
  348.  
  349.     e.g., GetEnv("PATH",buffer,80);
  350.       or  if(!GetEnv("PATH",buffer,80)) {
  351.                 ...
  352.           }
  353.  
  354. GETTIME.C --
  355.     int GetTime(&hour, &min, &sec) - Get Time Information
  356.         Returns:    hundreths of seconds
  357.         Where:
  358.             int hour
  359.             int min
  360.             int sec
  361.     
  362.     int SetTime(hour,min,sec,hundreths) - Set Time Information
  363.         Returns:    0=worked
  364.                    -1=error
  365.         Where:
  366.             int hour
  367.             int min
  368.             int sec
  369.             int hundreths    
  370.  
  371. HARDERR.A --
  372.     ERROR codes for hard_err are found in HARDERR.H
  373.     They can be indexed with harderrs[hard_err]
  374.  
  375.     We read about how to do this in the Cware NewLetter and simply translated
  376.     the code into assembler.
  377.     
  378.     void SetHardErr() - Set Up Trap for Device Errors
  379.         No Returns
  380.  
  381.     You can use this by setting hard_err to ERROR and trying to do 
  382.     whatever might cause a problem.  If a device error occurs, hard_err
  383.     will be set to the number of the error and can be used as an index
  384.     for harderrs[].  This also works well with the INTERRUPT.C functions
  385.     which can be used to save and restore interrupts.
  386.  
  387. INTEREST.C --
  388.     double interest(p,r,n,y) - Returns Interest Amount for a Loan
  389.  
  390.         This calculates the    interest rate for a loan given
  391.         the principal, payment, number of payments per year, and the
  392.         total number of payments for the loan.
  393.             Where:
  394.                 double p = principal
  395.                 double r = regular payment amount
  396.                 int n    = number of periods per year
  397.                 int y    = number of total periods
  398.  
  399.  
  400. INTERRUPT.C --
  401.     void GetInt(intnum, &segment, &offset)
  402.             Get Current Setting of the an Interrupt
  403.         No Returns
  404.         Where:
  405.             int intnum=interrupt number to retrieve (e.g., 0x24)
  406.             unsigned segment=buffer for the interrupt service routine's
  407.                              segment
  408.             unsigned offset =buffer for the interrupt service routine's
  409.                              offset past segment
  410.  
  411.             segment:offset is the vector address
  412.  
  413.     void SetInt(intnum, segment, offset)
  414.             Set the Interrupt Service Routine address for and interrupt
  415.         No Returns
  416.         Where:
  417.             int intnum=interrupt number to set (e.g., 0x24)
  418.             unsigned segment=interrupt service routine's segment
  419.             unsigned offset =interrupt service routine's offset past segment
  420.  
  421.             segment:offset is the vector address
  422.  
  423.         SetInt(0x24,_showcs(),myroutine);
  424.         or
  425.         SetInt(0x24,SavedSeg,SavedOffset);
  426.  
  427. JUL.C --
  428.     long jul(month, day, year) - Returns the number of days since 12/31/39
  429.         Julian dates are in a decent format for comparison.
  430.         Where:
  431.             int month
  432.             int day
  433.             int year
  434.  
  435. KEYIN.A --
  436.     int KeyIn() - Get a Key from the Keyboard Buffer
  437.         Returns:    a character if any available.
  438.                     0 if no key available
  439.  
  440.         This function also adds 128 to function and alt keys
  441.         so that the defines in ALTKEYS.H and FUNKEYS.H can be 
  442.         used.
  443.  
  444.     int KeyWait() - See if there is anything in the Keyboard Buffer
  445.                     but leave the character in the buffer.
  446.         Returns:    a character if any available
  447.                     0 if no key available
  448.  
  449.     int KeyStatus() - See if one of the special keys is pressed.
  450.         Returns:    Status where:
  451.             bit:
  452.                 0 - Right Shift Pressed
  453.                 1 - Left Shift Pressed
  454.                 2 - Ctrl/Shift Pressed
  455.                 3 - Alt/Shift Pressed
  456.                 4 - Scroll/Lock State Toggled
  457.                 5 - Numeric Lock State Toggled
  458.                 6 - Caps Lock State Toggled
  459.                 7 - Insert State Active
  460.  
  461.         Defines for the above are in KeyStatus.h
  462.                 RIGHT_SHIFT    0x01
  463.                 LEFT_SHIFT    0x02
  464.                 CTRL_SHIFT    0x04
  465.                 ALT_SHIFT    0x08
  466.                 SCROLL_LOCK    0x10
  467.                 NUM_LOCK    0x20
  468.                 CAPS_LOCK    0x40
  469.                 INSERT_KEY    0x80 
  470.     
  471. LASTPAY.C --
  472.     double lastpay(r,p,i,n,y)
  473.         Returns:    the amount of the Last Payment on a Loan
  474.         Where:
  475.             int r = regular payment amount
  476.             int p = principal of the loan
  477.             int i = annual interest rate
  478.             int n = number of periods per year
  479.             int y = number of total periods
  480.  
  481. LOCK.C --
  482.     int Lock(offset,length) - Locks parts of files under DOS 3.1
  483.         This can be used by DOS programs that run under network
  484.         environments to lock portions of a file so that multi
  485.         access is not allowed.
  486.         Returns:    0 if worked
  487.                 extended error code
  488.         Where:
  489.             long offset=offset in the file to start the lock
  490.             long length=number of bytes in the file to lock
  491.  
  492.     int UnLock(offset,length) - UnLocks parts of files under DOS 3.1
  493.         This should be used to unlock portions of files that were
  494.         locked using Lock().  The UnLock call must look exactly like
  495.         the Lock().
  496.         Returns:    0 if worked
  497.                 extended error code
  498.         Where:
  499.             long offset=offset in the file where lock begins
  500.             long length=number of bytes locked
  501.  
  502. LOGDSK.A --
  503.     int LogDsk(drive) - Set Current Drive Number
  504.         Returns:    Number Of disk drives attached
  505.                     0 if invalid drive specified
  506.         Where:
  507.             int drive = 0=A, 1=B, 2=C, ...
  508.  
  509.         When you log a drive it does not actually check to see if
  510.         a diskette is in the drive until you attempt to read or write.
  511.         If you want to check whether or not a diskette is in the 
  512.         drive do a dummy open and close and check hard_err.
  513.  
  514. MEMORY.A --
  515.     long MemSize() - Get Total Memory the System Has Installed
  516.         Returns:    Total memory
  517.  
  518.     long MemAvail() - Get Total Available Memory
  519.         Returns:    Available Memory
  520.         This memory includes that taken up by your program.  In other
  521.         words the total memory is that which you would have if your
  522.         program was not executing.
  523.  
  524. MINWITH.C --
  525.     double minwith(r,i,n,y) - Minimum Amount you need to Invest to
  526.         Withdraw a Fixed Amound Every Period.
  527.  
  528.         This calculates the initial    amount required to be
  529.         able to withdraw a specified amount    on a regular basis.
  530.         The calculation requires the amount    of the withdrawal,
  531.         nominal interest rate, number of withdrawals per year,
  532.         and the total number of withdrawals (assumes 1 withdrawal
  533.         per period).
  534.  
  535.         Returns:    Minimum investment
  536.         Where:
  537.             double r = regular withdrawal
  538.             double i = annual interest rate
  539.             int n    = number of withdrawals per year
  540.             int y    = number of total withdrawals
  541.  
  542. MKDIR.A --
  543.     int MkDir(directory) - Create a New Directory
  544.         Returns:    0=made directory successfully
  545.                     3=not a good path in str
  546.                     5=could not make directory
  547.         Where:
  548.             char *directory = directory to create
  549.  
  550. MODS.A --
  551.     int ChMod(file,attribute) - Change Attributes for a File
  552.         Returns:    0=successful
  553.                     2=file not found
  554.                     3=path not found
  555.                     4=access denied
  556.         Where:
  557.             char *file    = file to change
  558.             int attribute = attribute of the file
  559.  
  560.         Attributes are in FILEFIND.H and include the following:
  561.             F_NORMAL    0x00
  562.             F_READ_ONLY    0x01
  563.             F_HIDDEN    0x02
  564.             F_SYSTEM    0x04
  565.             F_LABEL        0x08
  566.             F_DIRECTORY    0x10
  567.             F_ARCHIVE    0x20
  568.             F_ALL        0xFF
  569.  
  570.         e.g., ChMod("MYFILE",F_NORMAL|F_READ_ONLY|F_HIDDEN);
  571.     
  572.     int GetMod(file,&attribute) - Get Attributes for a File
  573.         Returns:    0=successful
  574.                     2=file not found
  575.                     3=path not found
  576.                     4=access denied
  577.         Where:
  578.             char *file    = file to change
  579.             int attribute = buffer to store attribute of the file
  580.                 Notice that attribute is an integer pointer. 
  581.  
  582. NOMINAL.C --
  583.     double nominal(p,f,n,y) - Nominal Interest Rate for a Loan
  584.  
  585.          This calculates the nominal    interest rate for an investment
  586.          given the initial amount, the expected future amount, the
  587.          number of compounding periods per year, and the total number
  588.           of periods the    investment will exist.
  589.         Returns:    Nominal Interest Rate
  590.         Where:
  591.             double p = principal (initial investment)
  592.             double f = future value of the investment
  593.             int n    = number of payments per year
  594.             int y    = number of total payments
  595.  
  596. PAYMENT.C --
  597.     double payment(p,i,n,y) - Payment Amount for a Loan
  598.  
  599.         This calculates the payment    required to repay a loan
  600.         given the principal, interest, number of payments per year, and
  601.         the number of total periods (e.g., months) the loan will exist.
  602.         Returns:    Payment Amount
  603.         Where:
  604.             double p = principal
  605.             double i = interest payment rate
  606.             int n    = number of periods per year
  607.             int y    = number of total periods
  608.  
  609. PRINCIPAL --
  610.     double principal(r,i,n,y) - Principal for a Loan
  611.  
  612.         This calculates the amount that can be borrowed on a loan
  613.         given the payment, interest, number    of payments per year, and the
  614.         number of total periods (e.g., months) the loan will exist.
  615.         Returns:    Principal of the Loan
  616.         Where:
  617.             double r = regular payment
  618.             double i = interest payment rate
  619.             int n    = number of periods per year
  620.             int y    = number of total periods
  621.  
  622. PV.C --
  623.     double pv(f,i,n,y) - Present Value of a Future Sum
  624.  
  625.         This calculates the initial amount needed to reach
  626.         a future value for an investment given the future value,
  627.         annual interest, number of compounding periods per year,
  628.         and the total number of periods the    investment will exist.
  629.         Returns:    Present Value
  630.         Where:
  631.             double f = future value
  632.             double i = annual interest  rate
  633.             int n    = number of periods per year
  634.             int y    = number of total periods
  635.  
  636. REBOOT.A --
  637.     void Reboot() - Performs a software reboot of the system.
  638.  
  639.  
  640. REGDEPOSIT.C --
  641.     double regdeposit(f,i,n,y) - Regular Deposit Needed to Reach a
  642.                         Future Sum.
  643.  
  644.         This calculates the deposit amount required to reach
  645.         a desired future value given the future    value, nominal interest
  646.         rate, number of deposits per year, and the total number of
  647.         deposits that will be made (assumes    1 deposit per period)
  648.         Returns:    Regular Deposit
  649.         Where:
  650.             double f = future value desired
  651.             double i = annual interest rate
  652.             int n    = number of deposits per year
  653.             int y    = number of total deposits
  654.  
  655. RESET.A --
  656.     void Reset() - Resets the disk drives and flushes all of the file
  657.                     buffers.
  658.  
  659.  
  660. RMDIR.A --
  661.     int RmDir(directory) - Remove a directory
  662.         Returns:    0=made directory successfully
  663.                     3=not a good path in str
  664.                     5=could not make directory
  665.         Where:
  666.             char *directory = directory to create
  667.  
  668. ROUND.C --
  669.     double round(v,s) - Rounds to Significant Decimal Figure
  670.         Returns:    Rounded Result of V
  671.         Where:
  672.             double v = value to round
  673.             int s    = significant places ((-) left of decimal point
  674.                                  (+) right of the decimal point)
  675.  
  676. SLEEP.C --
  677.     void sleep(seconds) - Pauses Execution of a Program for (seconds)
  678.         Where:
  679.             int seconds = # of seconds to wait
  680.  
  681.  
  682. STRINDEX.C --
  683.     char *StrIndex(t,s) - Find a String Token in a given line.
  684.         Returns: 0 = string not found
  685.                  Address of the string in the line
  686.         Where:
  687.             char *t = pointer to token to find
  688.             char *s = pointer to string to seach
  689.  
  690. STRLOWER.C --
  691.     char *StrLower(s) - Convert a String to Lower Case
  692.         Returns: The address of the buffer you passed thru so that
  693.             you can do stuff like printf("%s",StrLower(s));
  694.         Where:
  695.             char *s = pointer to string to convert
  696.  
  697.  
  698. STRUPPER.O
  699.     char *StrUpper(s) - Convert a String to Upper Case
  700.         Returns: The address of the buffer you passed thru so that
  701.             you can do stuff like printf("%s",StrUpper(s));
  702.         Where:
  703.             char *s = pointer to string to convert
  704.  
  705. TERM.C --
  706.     double term(p,i,n,y) - Term of a Loan
  707.  
  708.         This calculates the number of periods (e.g., months)
  709.         a loan will    exist given the principal, interest,
  710.         number of payments per year, and the payment per period
  711.         for the loan.
  712.         Returns: Term of the Loan
  713.         Where:
  714.             double p = principal of the loan
  715.             double i = annual interest rate
  716.             int n    = number of periods per year
  717.             int y    = number of total periods
  718.  
  719. TICKS.A --
  720.     long Ticks() - Get Clock Ticks
  721.     Returns:    Current Clock Tick Count.  The PC clock ticks about
  722.                 18.21 times per second.
  723.  
  724. TIMESTAMP.A --
  725.     int GetStamp(file,&dosdate) - Get Modification Time for a File.
  726.     Returns:    0=Worked
  727.               2/4=File Not Found
  728.                 5=Access Denied
  729.     Where:
  730.         char *file = Pointer to File Name
  731.         long *dosdate = Long Buffer for the Date/Time Info
  732.  
  733.     int SetStamp(file,dosdate) - Set the Modification Time for a File.
  734.     Returns:    0=Worked
  735.               2/4=File Not Found
  736.                 5=Access Denied
  737.     Where:
  738.         char *file = Pointer to File Name
  739.         long dosdate = Long which contains the Date/Time Info
  740.  
  741.     File time stamps are calculated with the formula:
  742.         time = hour * 2048 + minute * 32 + seconds/2
  743.         date = (year-1980) * 512 + month * 32 + day
  744.     The time will be in the high order 2 bytes and the date in the lower.
  745.  
  746.     The Time Format is:
  747.       F E D C B A 9 8 7 6 5 4 3 2 1 0
  748.     +---------------------------------+
  749.     |   HOURS  |  MINUTES  |  SECS/2  |
  750.     +---------------------------------+
  751.  
  752.     The Date Format is:
  753.       F E D C B A 9 8 7 6 5 4 3 2 1 0
  754.     +---------------------------------+
  755.     |   YEAR-1980  | MONTH |   DAY    |
  756.     +---------------------------------+
  757.  
  758.  
  759. VERIFY.A --
  760.     int GetVerify() - Get the Current Setting of the DOS VERIFY Command
  761.     Returns:    0=OFF
  762.                 1=ON
  763.             
  764.     void SetVerify(VerifyVal) - Sets the Verify Flag.
  765.     Where:
  766.         int VerifyFlag = 0=OFF or 1=ON
  767.  
  768. VERSION.A --
  769.     int DosVer() = Gets Current DOS Version.
  770.     Returns:    0 if DOS version < 2
  771.                 otherwise version in high byte and release in low byte.
  772.  
  773. WITHDRAW.A --
  774.     double withdraw(p,i,n,y) - Amount you can Withdraw for an Investment.
  775.  
  776.         This calculates the amount that can be withdrawn
  777.         from an investment an a regular basis given the initial amount,
  778.         nominal interest rate, number of withdrawals per year, and
  779.         the total number of withdrawals (assumes 1 withdrawal per period)
  780.         Returns:    Amount you can Withdraw
  781.         Where:
  782.             double p = present value
  783.             double i = annual interest rate
  784.             int n    = number of withdrawals per year
  785.             int y    = number of total withdrawals
  786.  
  787. ------------------------------------------------------------------------
  788. Sample Programs:
  789. CAT.C      - Similar to Unix cat command.
  790.  
  791. CHMOD.C    - Set attributes for DOS files.  This one is similar to the 
  792.               Unix function of the same name.  Wild Cards are supported.
  793.  
  794. CP.C       - Similar to Unix cp command.
  795.  
  796. DATETIME.C - Displays the current date and time.
  797.  
  798. MV.C       - Similar to Unix mv command.
  799.  
  800. POP.C      - Restore the directory path saved with the PUSH.EXE command.
  801.  
  802. PUSH.C     - Save the current directory path and move to another.  Enter
  803.              the command: PUSH newdirectory <CR> to move to the new
  804.              directory and save the old one.  The path is saved in file
  805.              \PUSH.@@@
  806.  
  807. REB.C      - Reboot the Computer/REBOOT.EXE
  808.  
  809. SPACE.C    - Displays the current memory and disk sizes.
  810.  
  811. STUFF.C    - Get equipment status.
  812.  
  813. TOUCH.C    - Set time attributes for a file to the current clock setting.
  814.  
  815. Other Stuff:
  816. CURSOR.EXE - Sets the DOS Cursor.
  817.  
  818. PRT.EXE    - Formatted printing routine.
  819.  
  820.  
  821.